package cn.zl.springbootredis.redis;

import cn.zl.springbootredis.SpringbootRedisApplication;
import cn.zl.springbootredis.service.UserService.StudentService;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

/**
 * @Description:
 * @Author: zhanglang
 * @Date: 2020/9/8 8:58
 */
//启动Springboot应用
@SpringBootTest(classes = SpringbootRedisApplication.class)
@RunWith(SpringRunner.class)
public class TestStudentService {
    @Autowired
    private StudentService studentService;

    @Test
    public void testFindAll(){//测试缓存
        studentService.findAll().forEach(student -> System.out.println("user =" + student));
        System.out.println("====================================================");
        studentService.findAll().forEach(student -> System.out.println("user =" + student));//第二次会从mybatis的二级缓存获取
    }

}
